<?php
     @session_start();
    include("template/head.php");
  	//include("template/menu_left.php");   
    include("submit/Articles/test_qte.php");
	$sql = "SELECT * FROM `st_attr_entree` WHERE id_entree=".$_GET['id_entree'];
	$obj = new Mysql ();
	$result = mysql_query($sql);
	$row = mysql_fetch_object($result);
?>
<style type="text/css">
    #example_filter label input{
        height: 27px;
    }
</style>

    <div class="container-fluid">
        <div class="row-fluid">
                
        <?php include("template/menu_left.php") ?>                

        <div class="span9" id="content">
            <?php 
				if ((isset($_GET["action"])) && ($_GET["action"] == "mail_sent"))
				{
				echo'
				<div class="alert alert-success" style="margin:10px 0 10px 0;">
					Email envoyé avec succèss <button type="button" class="close" data-dismiss="alert">&times;</button>
				</div>';
				}
				if ((isset($_GET["action"])) && ($_GET["action"] == "mail_error"))
			    {
			    echo'
			    <div class="alert alert-danger" style="margin:10px 0 10px 0;">
				    une erreur s\'est produit durant l\'envoie. <button type="button" class="close" data-dismiss="alert">&times;</button>
				</div>';
				}
			?>
            <div class="row-fluid">
			<!-- block -->
            <div class="block">
              <div class="navbar navbar-inner block-header">
                <div class="muted pull-left">Information Article</div>
              </div>
              <div class="block-content collapse in">
                <div class="span12">
                    <table class="table table-condensed table-hover">
						<thead>
							<tr>
								<th>Réference</th>
								<th>Désignation</th>
								<th>Date d'ajout</th>
							</tr>
						</thead>
						<tbody>    
						<tr>
							<td><?php echo getRefArticle($row->id_article); ?></td>
							<td><?php echo nl2br(getDesignation($row->id_article)); ?></td>
							<td><?php 
								$dateNewFormat = explode("/", $row->date_add);
	                            echo $dateNewFormat[1].'/'.$dateNewFormat[0].'/'.$dateNewFormat[2];
	                            ?>
						</td>
						</tr>
						</tbody>
					</table>
					
					<table cellpadding="0" cellspacing="0" border="0" class="table table-striped" style="margin-top: 20px;">
                  	<thead>
                      <tr>
                        <th style="vertical-align: top;" class="span2">Observation : </th>
                        <th style="font-weight: normal;"><?php echo nl2br($row->note); ?></th>
                      </tr>
                    </thead>	
                  </table>
                </div>
              </div>
            </div>
        	<!-- /block -->
			
			<!-- block -->
            <div class="block">
              <div class="navbar navbar-inner block-header">
                <div class="muted pull-left">Fournisseur
                	<?php
						$fournisseurTable = getFournisseur($row->id_fournisseur); 
					?>
				</div>
              </div>
              <div class="block-content collapse in">
                <div class="span12">
                    <table class="table table-condensed table-hover">
						<thead>
							<tr>
								<th>Raison Social</th>
								<th>Nom</th>
								<th>Prénom</th>								
								<th>Téléphone</th>
								<th>Fax</th>
								<th>Email</th>
							</tr>
						</thead>
						<tbody>    
						<tr>
							<td style="padding-right:2px;"><?php echo $fournisseurTable['raison_social'] ?></td>
							<td><?php echo $fournisseurTable['nom'] ?></td>
							<td><?php echo $fournisseurTable['prenom'] ?></td>							
							<td><?php echo $fournisseurTable['tel']?></td>
							<td><?php echo $fournisseurTable['fax']?></td>
							<td><?php echo $fournisseurTable['email']?></td>
						</tr>
						</tbody>
					</table>
                </div>
              </div>
            </div>
        	<!-- /block -->
			<!-- block -->
            <div class="block">
              <div class="navbar navbar-inner block-header">
                <div class="muted pull-left">Détails de l'opération</div>
              </div>
              <div class="block-content collapse in">
                <div class="span12">
                    <table class="table table-condensed table-hover">
						<thead>
							<tr>
								<th>Quantité Ajoutée</th>
								<th>Unité de stockage</th>
								<th>Prix d'achat (TND) </th>
								<th>Prix d'achat en devise </th>
							</tr>
						</thead>
						<tbody>    
							<tr>
								<td><?php echo  number_format($row->qte, 0, '', ' ')?></td>
							  	<td><?php echo getUnitArticle($row->id_article)?></td>
							  	<?php 
								$euroPrix =  $row->prix * 0.443;
								$dinarPrix= $row->prix;
							  	?>
							  	<td><?php echo $dinarPrix ?></td>
                                                                <?php
                                                                	if (!empty($row->id_devise)) {
							  										
                                                                $sqt = "select nom_monnaie from st_att_monnaie where id_monnaie =".$row->id_devise;
                                                                //echo $sqt;
                                                                $restl = mysql_query($sqt);
                                                                $d= mysql_fetch_array($restl);
                                                            	}
                                                            	
                                                                
                                                                ?>
							  	<td><?php 
							  		if (empty($row->id_devise)) {
							  			echo 'Fournisseur tunisien';
							  		} else {
							  			echo $row->prix_en_devise.' '.$d["nom_monnaie"];
							  		}
							  	
							  	?></td>
							</tr>
						</tbody>
					</table>
                </div>
              </div>
            </div>
        	<!-- /block -->
			 <!-- block -->
				<div class="span12">
					<a class="btn btn-primary btn-sm" href="javascript:history.back()" style="float:right;width:200px;margin:20px;" >Retour</a>
				</div>
				
			<!--// block -->
			
          </div>
		</div>
        </div>
		<hr>
    </div>
<?php  include("template/footer.php") ; ?>